package appapi.dao;

import appapi.entity.mqtt.Areapath;
import appapi.entity.mqtt.mqttvo.AreaVo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @version: java version 1.8
 * @Author: Ygp Work
 * @description:
 * @date: 2023-07-07 10:16
 */
@Mapper
public interface AreapathMapper {
    @Insert("INSERT INTO areapath (status, regionname, servicepath, d_id) " +
            "VALUES ( #{status}, #{regionname}, #{servicepath}, #{dId})")
    void insertAreapath(Areapath areapath);

    @Select("select id ,regionname, servicepath, d_id from areapath")
    List<Areapath> getAll(Areapath areapath);

    @Select("SELECT a.regionname,a.id,d.* FROM devices d JOIN areapath a ON d.address = a.regionname WHERE a.id = #{Id}")
    List<AreaVo> getAllReserves(Long Id);


}
